package com.tjec.project.businessWorkbench.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tjec.framework.aspectj.lang.annotation.Log;
import com.tjec.framework.aspectj.lang.enums.BusinessType;
import com.tjec.framework.security.service.TokenService;
import com.tjec.project.businessWorkbench.domain.BmsMdBusinessIndicatorReport;
import com.tjec.project.businessWorkbench.service.IBmsMdBusinessIndicatorReportService;
import com.tjec.framework.web.controller.BaseController;
import com.tjec.framework.web.domain.AjaxResult;
import com.tjec.common.utils.ServletUtils;
import com.tjec.common.utils.poi.ExcelUtil;
import com.tjec.framework.web.page.TableDataInfo;

/**
 * 业务指标填报Controller
 * 
 * @author pangyognfeng
 * @date 2020-06-02
 */
@RestController
@RequestMapping("/indicatorReport/indicatorReport")
public class BmsMdBusinessIndicatorReportController extends BaseController
{
    @Autowired
    private IBmsMdBusinessIndicatorReportService bmsMdBusinessIndicatorReportService;
    @Autowired
    private TokenService tokenService;

    /**
     * 获取业务指标填报详细信息
     */
    //@PreAuthorize("@ss.hasPermi('indicatorReport:indicatorReport:query')")
    @PostMapping(value = "/getInfo")
    public AjaxResult getInfo(@RequestBody BmsMdBusinessIndicatorReport bmsMdBusinessIndicatorReport)
    {
    	BmsMdBusinessIndicatorReport res = bmsMdBusinessIndicatorReportService.selectBmsMdBusinessIndicatorReport(bmsMdBusinessIndicatorReport);
        return AjaxResult.success(res);
    }

    /**
     * 新增业务指标填报
     */
   // @PreAuthorize("@ss.hasPermi('indicatorReport:indicatorReport:add')")
    @Log(title = "业务指标填报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BmsMdBusinessIndicatorReport bmsMdBusinessIndicatorReport)
    {
    	//bmsMdBusinessIndicatorReport.setCreateBy(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
        return AjaxResult.success(bmsMdBusinessIndicatorReportService.insertBmsMdBusinessIndicatorReport(bmsMdBusinessIndicatorReport));
    }

    /**
     * 修改业务指标填报
     */
    //@PreAuthorize("@ss.hasPermi('indicatorReport:indicatorReport:edit')")
    @Log(title = "业务指标填报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BmsMdBusinessIndicatorReport bmsMdBusinessIndicatorReport)
    {
    	//bmsMdBusinessIndicatorReport.setUpdateBy(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
        return toAjax(bmsMdBusinessIndicatorReportService.updateBmsMdBusinessIndicatorReport(bmsMdBusinessIndicatorReport));
    }

}
